import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { Language } from "../../../../extend/language/Language";
import { BaseItemNormal } from "../common/item/BaseItemNormal";
import { RewardInfo } from "./RewardInfo";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class MagicWeaponRewardCellRender
    
    export  class MagicWeaponRewardCellRender extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            ObjCreate.createBg(5, 78, 295, 2, this, ImagesConst.SplitLine);
            var loc1=new GTextFormat(FontUtil.xingkaiName, 14, 6350622);
            this._rankTxt = ObjCreate.createGTextField("", 152, 11, 100, 20, this, loc1);
            ObjCreate.createGTextField(Language.getString(90317), 15, 40, 80, 20, this);
            this._itemNameTxt = ObjCreate.createTextField("", 51, 39, 120, 20, this, null, true, false);
            this._rewardItem = new BaseItemNormal();
            this._rewardItem.setSize(32, 32);
            this._rewardItem.isDragAble = false;
            this._rewardItem.isDropAble = false;
            ObjCreate.setObjAttri(this._rewardItem, 238, 19, -1, -1, this);
            this._rankBmp = ObjCreate.createBitmap(ImagesConst.magicWR_reward0, 15, 12, this);
            this._rankBmp2 = ObjCreate.createBitmap(ImagesConst.magicWR_reward3, 163, 11, this);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            var loc1=arg1 as RewardInfo;
            if (loc1 == null) 
            {
                this._rewardItem.data = null;
                return;
            }
            this._rankTxt.text = loc1.key;
            this._rankBmp2.x = this._rankTxt.x + this._rankTxt.textWidth + 10;
            this._rewardItem.itemData = loc1.itemdata;
            this._itemNameTxt.htmlText = loc1.itemdata.itemInfo.htmlName;
            if (loc1.isCross) 
            {
                this._rankBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.magicWR_reward1);
            }
            else 
            {
                this._rankBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.magicWR_reward0);
            }
            return;
        }

        /* internal */ /* var */_rankBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rankTxt: GTextFiled;

        /* internal */ /* var */_rewardItem: BaseItemNormal;

        /* internal */ /* var */_itemNameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_rankBmp2: Object /* flash.display.Bitmap */;
    }
